package parser;

public class PSetSite {
//attribution
	public short siteType;
	public String IP;
	public int port;
	public String siteName;
	public short setType;
//method
	PSetSite(String s){
		String []sAry;
		sAry = s.split("\\s+");
		try{
			if(sAry[1].compareTo("CONTROLSITE")==0) {
				siteType = PConstants.CONSTROL_SITE;
				setType = PConstants.SET_CONTROL_SITE;
			}
			else if(sAry[1].compareTo("SITE")==0){
				short st = PConstants.LOCAL_SITE1;
				if(sAry[3].compareTo("Site2")==0)
					st = PConstants.LOCAL_SITE1;
				else if(sAry[3].compareTo("Site3")==0)
					st = PConstants.LOCAL_SITE2;
				else if(sAry[3].compareTo("Site4")==0)
					st = PConstants.LOCAL_SITE3;
				setType = PConstants.SET_LOCAL_SITE;
				siteType = st;
				
			}
			int pos = sAry[2].indexOf(':');
			IP = sAry[2].substring(0,pos);
			port = Integer.parseInt(sAry[2].substring(pos+1));
			siteName = sAry[3];
		}
		catch (RuntimeException e){
			//e.printStackTrace();
		}
	}
}
